<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class interprocess_condition</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../interprocess/indexes_reference.html#header.boost.interprocess.sync.interprocess_condition_hpp" title="Header &lt;boost/interprocess/sync/interprocess_condition.hpp&gt;">
<link rel="prev" href="file_lock.html" title="Class file_lock">
<link rel="next" href="interprocess_condition_any.html" title="Class interprocess_condition_any">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="file_lock.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#header.boost.interprocess.sync.interprocess_condition_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="interprocess_condition_any.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.interprocess.interprocess_condition"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class interprocess_condition</span></h2>
<p>boost::interprocess::interprocess_condition</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../interprocess/indexes_reference.html#header.boost.interprocess.sync.interprocess_condition_hpp" title="Header &lt;boost/interprocess/sync/interprocess_condition.hpp&gt;">boost/interprocess/sync/interprocess_condition.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="interprocess_condition.html" title="Class interprocess_condition">interprocess_condition</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="interprocess_condition.html#boost.interprocess.interprocess_conditionconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="interprocess_condition.html#idm30645-bb"><span class="identifier">interprocess_condition</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="interprocess_condition.html#idm30649-bb"><span class="special">~</span><span class="identifier">interprocess_condition</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="interprocess_condition.html#idm30536-bb">public member functions</a></span>
  <span class="keyword">void</span> <a class="link" href="interprocess_condition.html#idm30537-bb"><span class="identifier">notify_one</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="interprocess_condition.html#idm30541-bb"><span class="identifier">notify_all</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="interprocess_condition.html#idm30545-bb"><span class="identifier">wait</span></a><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> Pr<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="interprocess_condition.html#idm30554-bb"><span class="identifier">wait</span></a><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Pr</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
    <span class="keyword">bool</span> <a class="link" href="interprocess_condition.html#idm30565-bb"><span class="identifier">timed_wait</span></a><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">,</span> <span class="keyword">typename</span> Pr<span class="special">&gt;</span> 
    <span class="keyword">bool</span> <a class="link" href="interprocess_condition.html#idm30577-bb"><span class="identifier">timed_wait</span></a><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Pr</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
    <span class="identifier">cv_status</span> <a class="link" href="interprocess_condition.html#idm30591-bb"><span class="identifier">wait_until</span></a><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">,</span> <span class="keyword">typename</span> Pr<span class="special">&gt;</span> 
    <span class="keyword">bool</span> <a class="link" href="interprocess_condition.html#idm30603-bb"><span class="identifier">wait_until</span></a><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Pr</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> Duration<span class="special">&gt;</span> 
    <span class="identifier">cv_status</span> <a class="link" href="interprocess_condition.html#idm30618-bb"><span class="identifier">wait_for</span></a><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> Duration<span class="special">,</span> <span class="keyword">typename</span> Pr<span class="special">&gt;</span> 
    <span class="keyword">bool</span> <a class="link" href="interprocess_condition.html#idm30630-bb"><span class="identifier">wait_for</span></a><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Pr</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.17.17.3.58.4.4"></a><h2>Description</h2>
<p>This class is a condition variable that can be placed in shared memory or memory mapped files. Destroys the object of type std::condition_variable_any</p>
<p>Unlike std::condition_variable in C++11, it is NOT safe to invoke the destructor if all threads have been only notified. It is required that they have exited their respective wait functions. </p>
<div class="refsect2">
<a name="id-1.3.17.17.3.58.4.4.4"></a><h3>
<a name="boost.interprocess.interprocess_conditionconstruct-copy-destruct"></a><code class="computeroutput">interprocess_condition</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idm30645-bb"></a><span class="identifier">interprocess_condition</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Constructs a <code class="computeroutput"><a class="link" href="interprocess_condition.html" title="Class interprocess_condition">interprocess_condition</a></code>. On error throws <code class="computeroutput"><a class="link" href="interprocess_exception.html" title="Class interprocess_exception">interprocess_exception</a></code>. </li>
<li class="listitem">
<pre class="literallayout"><a name="idm30649-bb"></a><span class="special">~</span><span class="identifier">interprocess_condition</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Destroys *this liberating system resources. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.17.17.3.58.4.4.5"></a><h3>
<a name="idm30536-bb"></a><code class="computeroutput">interprocess_condition</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm30537-bb"></a><span class="identifier">notify_one</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>If there is a thread waiting on *this, change that thread's state to ready. Otherwise there is no effect. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm30541-bb"></a><span class="identifier">notify_all</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Change the state of all threads waiting on *this to ready. If there are no waiting threads, notify_all() has no effect. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm30545-bb"></a><span class="identifier">wait</span><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span> lock<span class="special">)</span><span class="special">;</span></pre>
<p>Releases the lock on the <code class="computeroutput"><a class="link" href="interprocess_mutex.html" title="Class interprocess_mutex">interprocess_mutex</a></code> object associated with lock, blocks the current thread of execution until readied by a call to this-&gt;notify_one() or this-&gt;notify_all(), and then reacquires the lock. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> Pr<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm30554-bb"></a><span class="identifier">wait</span><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span> lock<span class="special">,</span> <span class="identifier">Pr</span> pred<span class="special">)</span><span class="special">;</span></pre>
<p>The same as: while (!pred()) wait(lock) </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
  <span class="keyword">bool</span> <a name="idm30565-bb"></a><span class="identifier">timed_wait</span><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span> lock<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Releases the lock on the <code class="computeroutput"><a class="link" href="interprocess_mutex.html" title="Class interprocess_mutex">interprocess_mutex</a></code> object associated with lock, blocks the current thread of execution until readied by a call to this-&gt;notify_one() or this-&gt;notify_all(), or until time abs_time is reached, and then reacquires the lock. Returns: false if time abs_time is reached, otherwise true. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">,</span> <span class="keyword">typename</span> Pr<span class="special">&gt;</span> 
  <span class="keyword">bool</span> <a name="idm30577-bb"></a><span class="identifier">timed_wait</span><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span> lock<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">,</span> <span class="identifier">Pr</span> pred<span class="special">)</span><span class="special">;</span></pre>
<p>The same as: while (!pred()) { if (!timed_wait(lock, abs_time)) return pred(); } return true; </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
  <span class="identifier">cv_status</span> <a name="idm30591-bb"></a><span class="identifier">wait_until</span><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span> lock<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">timed_wait</code>, but this function is modeled after the standard library interface. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">,</span> <span class="keyword">typename</span> Pr<span class="special">&gt;</span> 
  <span class="keyword">bool</span> <a name="idm30603-bb"></a><span class="identifier">wait_until</span><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span> lock<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">,</span> <span class="identifier">Pr</span> pred<span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">timed_wait</code>, but this function is modeled after the standard library interface. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> Duration<span class="special">&gt;</span> 
  <span class="identifier">cv_status</span> <a name="idm30618-bb"></a><span class="identifier">wait_for</span><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span> lock<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span> dur<span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">timed_wait</code>, but this function is modeled after the standard library interface and uses relative timeouts. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> L<span class="special">,</span> <span class="keyword">typename</span> Duration<span class="special">,</span> <span class="keyword">typename</span> Pr<span class="special">&gt;</span> 
  <span class="keyword">bool</span> <a name="idm30630-bb"></a><span class="identifier">wait_for</span><span class="special">(</span><span class="identifier">L</span> <span class="special">&amp;</span> lock<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span> dur<span class="special">,</span> <span class="identifier">Pr</span> pred<span class="special">)</span><span class="special">;</span></pre>
<p>Same as <code class="computeroutput">timed_wait</code>, but this function is modeled after the standard library interface and uses relative timeouts </p>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2005-2015 Ion Gaztanaga<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="file_lock.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#header.boost.interprocess.sync.interprocess_condition_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="interprocess_condition_any.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
